package com.md.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 刘骄阳
 * 2022-04-01 15:24
 */
@Data
public class BasePO implements Serializable {
  /**
   * 唯一标识id
   */
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  @TableId(type = IdType.AUTO)
  private Long id;

  /**
   * 创建时间
   */
  @TableField(fill = FieldFill.INSERT)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private LocalDateTime createDate;
  /**
   * 修改时间
   */
  @TableField(fill = FieldFill.INSERT_UPDATE)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private LocalDateTime updateDate;
  /**
   * 创建者
   */
  @TableField(fill = FieldFill.INSERT)
  private Long createBy;
  /**
   * 更新者
   */
  @TableField(fill = FieldFill.INSERT_UPDATE)
  private Long updateBy;

  /**
   * 是否可用(1:不可用;0:可用)
   */
  @TableLogic
  private Boolean isDeleted;

  @Version
  @TableField(fill = FieldFill.INSERT)
  private Integer version;
}
